fix(install): validate redirect URL origin before trusting resolved version#662
Open
latenighthackathon wants to merge 1 commit intoNVIDIA:mainfrom
Open
Conversation
…ersion resolve_redirect() follows HTTP redirects to determine the latest release tag, but never validated that the final URL still pointed to the expected GitHub repository. A compromised CDN, DNS poisoning, or an open redirect could cause the installer to extract a version tag from — and subsequently download binaries from — an attacker-controlled origin. Add origin validation: reject resolved URLs that don't match https://github.com/NVIDIA/OpenShell/*. Also cap redirect depth in download() to 5 as defense-in-depth. Closes NVIDIA#638 Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
|
All contributors have signed the DCO ✍️ ✅ |
Contributor
Author
|
I have read the DCO document and I hereby sign the DCO. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
resolve_redirect()follows HTTP redirects to determine the latest release tag but never validates the final URL origin. A compromised CDN, DNS poisoning, or open redirect could cause the installer to download binaries from an attacker-controlled server. This adds origin validation and caps redirect depth as defense-in-depth.Related Issue
Closes #638
Changes
resolve_redirect(): resolved URLs must matchhttps://github.com/NVIDIA/OpenShell/*or the installer aborts.download()to 5 as defense-in-depth.Testing
mise run pre-commitpassesExecuted:
mise run pre-commitlocally: format, license, and lint checks passinstall.shtest jobs pass in CI (bash, sh, fish, zsh all green)Checklist